package thread;

public class Demo19 {

    private static int count = 0;

    public static void main(String[] args) {
        Object lock = new Object();

        Thread t1 = new Thread(()->{
            for (int i = 0; i < 50000; i++) {
                synchronized (lock) {
                    synchronized (lock) { //二次加锁，等待阻塞，死锁（dead lock）
                        count++;
                    }
                }
            }
        });

        t1.start();

        System.out.println("count:" + count);

    }
}
